package spring.cloud.tasks.common.nodepaths;

import spring.cloud.tasks.common.Symbols;

public class TaskInstanceNodePaths {
    public static final String ROOT = Symbols.SLASH + "task_instances ";

    public static String getTaskInstancesNodePath(String taskId) {
        return ROOT + Symbols.SLASH + taskId;
    }

    public static String getTaskInstanceNodePath(String taskId, String taskInstanceId) {
        return getTaskInstancesNodePath(taskId) + Symbols.SLASH + taskInstanceId;
    }

    public static String getTaskInstanceSubNodePath(String taskId, String taskInstanceId, String subNode) {
        return getTaskInstanceNodePath(taskId, taskInstanceId) + Symbols.SLASH + subNode;
    }

    //子阶段如下
    public static final class TaskInstanceSubNode {
        public static final String baseInfo = "base-info";
        public static final String createTaskItems = "create-task-items";
        public static final String schedule = "schedule";//实例信息调度
        /**
         * 这个标记在调度器重新启动的时候很重要。只要打上了这个标记，那么则不重新进行调度。如果想重跑。点击该实例重跑或者新建实例跑。
         * 看到这个标记后，实例状态维护程序，需要取消调度。
         */
        public static final String tryCancel = "tryCancel";
        public static final String status = "status";
    }

}
